import { IFeidaoAiBrowserComponent } from '@dfeidao/atom-web/interfaces';
import nodejs from "@dfeidao/atom-web/msg/nodejs";
import render from "@dfeidao/atom-web/render/render";
// import whoami from '@dfeidao/atom-web/msg/whoami';

import p001 from './p001';

import set from '@dfeidao/atom-web/local/set';
import s_get from '@dfeidao/atom-web/storage/get';
// import { send_msg as url, get_user_info } from './config';



export default async function a005(fd: IFeidaoAiBrowserComponent, args: {
	_id: string,
	usercode: string,
	role_no: string,
	arr: object[]
}) {
	//  调用事件
	fd.data.node.classList.remove('display-n');
	const rolef = args;
	// console.log(rolef)
	set(fd, '_id', rolef._id);
	set(fd, 'ucode', rolef.usercode);
	set(fd, 'r_no', rolef.role_no);
	// const user = await whoami(get_user_info);
	// console.log(user)
	const prid = await s_get('productid');
	const query = {
		filter: {
			productid: prid
		}
	};
	const res = await nodejs<{ count: number; dataArray: object[] }>("consumer/zj-000006/consumer-find2", query);
	rolef.arr = res.dataArray;
	render(fd, rolef, p001, 'p001', 'inner');
	fd.data.node.querySelector<HTMLSelectElement>('#name2').value = rolef.role_no;

}
